<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//ajax回调地狱问题
			ajax({
				url: '张三去面试'
				success: function(data1) {
					ajax({
						url: '李四去面试'
						success: function(data2) {
							ajax({
								url: '王五去面试'
								success: function(data3) {
									ajax({
										url: '赵六去面试'
										success: function(data4) {

										}
									})
								}
							})
						}
					})
				}
			})

			const p = new Promise(function(resolve, reject) {
				ajax({
					url: '张三去面试'
					success: function(data1) {
                         resolve(data1)
					}
				})
			})
			
			p.then(function(data1){
				ajax({
					url: '李四去面试'
					success: function(data2) {
				         resolve(data2)
					}
				})
			}).then(function(data2){
				ajax({
					url: '王五去面试'
					success: function(data3) {
						resolve(data3);
					}
				})
			}).then(function(data3){
				ajax({
					url: '赵六去面试'
					success: function(data4) {
								
					}
				})
			})
		</script>
	</body>
</html>
